package com.k1998.mybatis.controller;

import com.alibaba.fastjson.JSON;
import com.k1998.mybatis.bean.AdminLogin;
import com.k1998.mybatis.config.WxPayConfig;
import com.k1998.mybatis.entity.Product;
import com.k1998.mybatis.service.ProductService;
import com.k1998.mybatis.utils.QueryInfo;
import com.k1998.mybatis.dao.IAdminLoginDao;
import com.k1998.mybatis.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

@RestController
@Api(tags = {"管理员Api文档"})
@RequestMapping("/api/product")
public class AdminLoginController {

    @Autowired
    private IAdminLoginDao iAdminLoginDao;

    @Resource
    private WxPayConfig wxPayConfig;

    @Resource
    private ProductService productService;
    @GetMapping("/test")
    public R test() {
        String mchId = wxPayConfig.getMchId();
        return R.ok().data("mchId", "测试");
    }

    @ApiOperation("获取商品列表接口")
    @GetMapping("/list")
    public R getProductList() {
        List<Product> productList = productService.list();
        return R.ok().data("productList", productList);
    }


}
